package com.yangxc.applet.config;

import com.baidu.aip.bodyanalysis.AipBodyAnalysis;
import com.baidu.aip.imageprocess.AipImageProcess;
import com.baidu.aip.ocr.AipOcr;
import com.yangxc.applet.utils.BaiduProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author yangxc
 * @version 1.0.0
 * @ClassName BaiduConfig.java
 * @Description TODO
 * @createTime 2022年10月03日 21:51:00
 */
@Configuration
public class BaiduConfig {
    
    @Resource
    BaiduProperties baiduProperties;
    
    @Bean
    public AipBodyAnalysis aipBodyAnalysis(){
        return new AipBodyAnalysis(baiduProperties.getBodyAppId(), baiduProperties.getBodyApiKey(), baiduProperties.getBodySecretKey());
    }
    
    @Bean
    public AipOcr aipOcr(){
        return new AipOcr(baiduProperties.getOcrAppId(), baiduProperties.getOcrApiKey(), baiduProperties.getOcrSecretKey());
    }
    
    @Bean
    public AipImageProcess aipImageProcess(){
        return new AipImageProcess(baiduProperties.getImageAppId(), baiduProperties.getImageApiKey(), baiduProperties.getImageSecretKey());
    }
}
